package inph.account.common;

import javax.servlet.http.HttpSession;

import org.directwebremoting.WebContextFactory;

public class UserInfo {
	public final static String USER_SESSION = "USER_SESSION";
	
	private String name="";
	
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	

	public static UserInfo getCurrentUser(){
		UserInfo user = null;
		HttpSession session = WebContextFactory.get().getSession();
		Object tUser = session.getAttribute(USER_SESSION);
		if(tUser!=null)
			user=(UserInfo)tUser;
		else{
			user = new UserInfo();
			session.setAttribute(USER_SESSION,user);
		}
		return user;
	}
}
